import request from '../utils/request'

export const uploadImg = process.env.VUE_APP_BASE_URL + 'system/file/upload/image'
export const uploadVideo = process.env.VUE_APP_BASE_URL + 'system/file/upload/video'
export const uploadPdf = process.env.VUE_APP_BASE_URL + 'system/file/upload/pdf'
export const uploadExcel = process.env.VUE_APP_BASE_URL + 'system/file/uploadFile'// 上传excel文件
export const downloadExcel = process.env.VUE_APP_BASE_URL + 'system/file/downloadFile'// 下载excel文件

export const deleteImg = (id, url) => {
  return request.post('system/file/deleteImg', {}, {
    params: {
      id, url
    }
  })
}

export const getDataList = (params) => {
  return request.get('/system/data/getDataList', { params })
}

export const getItemList = (params) => {
  return request.get('/system/data/itemList', { params })
}

export const editData = (params) => {
  return request.post('/system/data/editData', { ...params.learningDTO }, { params: { learningId: params.learningId } })
}

// 资料类目管理
export const getCateDataList = (params) => {
  return request.get('/system/dataItems/list', { params })
}

// 数据模型管理模块
export const getModelList = (params) => {
  return request.get('/system/dataModel/getModelList', { params })
}
export const removeDataModel = (params) => {
  return request.post('/system/dataModel/removeDataModel', { ...params })
}
export const addData = (params) => {
  return request.post('/system/dataModel/addData', { ...params })
}
export const readModel = (params) => {
  return request.post('/system/dataModel/dataModel', {}, { params: { ...params } })
}
export const editDataModel = (params) => {
  return request.post('/system/dataModel/editDataModel', { ...params }, { params: { modelId: params.modelId } })
}
